import 'package:flutter/material.dart';

class AfChatTextfield extends StatelessWidget {
  const AfChatTextfield({
    Key? key,
    this.text = "",
    this.deleteTap,
    this.placeholder = "",
    this.errorText = "",
    this.fillColor,
    this.hintColor,
    this.autoFocus = false,
    this.focusNode,
    this.onChange,
    this.onSubmitted,
    this.suffixIcon,
    this.suffixIconConstraints,
    this.prefixIcon,
    this.prefixIconConstraints,
    this.contentPadding,
    this.controller,
    this.borderRadius = 10,
    this.isHilightState = true,
    this.onEditingComplete,
    this.onTap,
  }) : super(key: key);

  final String text;
  final String placeholder;
  final String errorText;
  final EdgeInsets? contentPadding;
  final Color? fillColor;
  final Color? hintColor;
  final bool isHilightState;
  final bool autoFocus;
  final double borderRadius;
  final FocusNode? focusNode;
  final ValueChanged<String>? onChange;
  final Function? deleteTap;
  final ValueChanged<String>? onSubmitted;
  final Widget? suffixIcon;
  final BoxConstraints? suffixIconConstraints;
  final Widget? prefixIcon;
  final BoxConstraints? prefixIconConstraints;
  final TextEditingController? controller;
  final VoidCallback? onEditingComplete;
  final Function()? onTap;
  @override
  Widget build(BuildContext context) {
    return TextField(
      autofocus: autoFocus,
      keyboardType: TextInputType.multiline,
      textInputAction: TextInputAction.send,
      cursorColor: const Color(0xff000000),
      controller: controller,
      focusNode: focusNode,
      onTap: onTap,
      clipBehavior: Clip.antiAlias,
      onChanged: onChange,
      minLines: 1,
      maxLines: 3,
      onSubmitted: onSubmitted,
      onEditingComplete: onEditingComplete,
      style: const TextStyle(
        color: Color(0xff000000),
        fontWeight: FontWeight.w400,
        fontSize: 16,
      ),
      decoration: InputDecoration(
        border: OutlineInputBorder(
          borderRadius: BorderRadius.circular(borderRadius),
          borderSide: BorderSide.none,
        ),
        filled: true,
        fillColor: fillColor,
        hintText: placeholder,
        hintStyle: TextStyle(
          color: hintColor ?? const Color(0xff94A3B8),
          fontSize: 16,
          fontWeight: FontWeight.w400,
        ),
        contentPadding: const EdgeInsets.fromLTRB(12, 0, 0, 12),
        prefixIcon: prefixIcon,
        prefixIconConstraints: prefixIconConstraints,
        suffixIconConstraints:
            const BoxConstraints(maxWidth: 70, maxHeight: 40),
        suffixIcon: suffixIcon,
      ),
    );
  }
}
